import api from '@/services/customer/points-transfer';

export type PointsTransfter = PointsTransferApi.InfoResponse;
export type PointsTransfterList = PointsTransferApi.ListResponse;
export const getFilterList = async () => {
  const res = await api.getFilterList();
  return res.data;
};
export const getList = async (params: PointsTransferApi.ListParams) => {
  const res = await api.getList<PointsTransfterList>(params);
  const tableData: Requestor.TableFormatedData<PointsTransfterList> = {
    data: res.listData,
    current: res.page + 1,
    pageSize: res.limit,
    total: res.count,
    success: res.success,
  };

  return tableData;
};

export const getInfo = async (params: PointsTransferApi.InfoParams) => {
  const res = await api.getInfo<PointsTransfter>(params);
  return res.data;
};

export default {
  getFilterList,
  getList,
  getInfo,
};
